//tab切换
$("ul.tabtit").on("click", function(event) {
	var target = event.target;
	var index = $(target).index();
	$(target).addClass("current");
	$(target).siblings().removeClass("current");
	$("div.ittab").hide();
	$("div.ittab").eq(index).show();
});

$(function() {
	// 默认加载第一个选项卡
	$("div.ittab").hide();
	$("div.ittab").eq(0).show();
});

function formatDate(now) {
	var year = now.getFullYear();
	var month = now.getMonth() + 1;
	var date = now.getDate();
	var hour = now.getHours();
	var minute = now.getMinutes();
	var second = now.getSeconds();
	return year + "-" + month + "-" + date;
}

function formatDateHHMMSS(now) {
	var year = now.getFullYear();
	var month = now.getMonth() + 1;
	var date = now.getDate();
	var hour = now.getHours();
	var minute = now.getMinutes();
	var second = now.getSeconds();
	return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":"
			+ second;
}

function ww3(date) {
	var y = date.getFullYear();
	var m = date.getMonth() + 1;
	var d = date.getDate();
	var h = date.getHours();
	var min = date.getMinutes();
	var sec = date.getSeconds();
	var str = y + '/' + (m < 10 ? ('0' + m) : m) + '/'
			+ (d < 10 ? ('0' + d) : d) + '/' + ' ' + (h < 10 ? ('0' + h) : h)
			+ ':' + (min < 10 ? ('0' + min) : min) + ':'
			+ (sec < 10 ? ('0' + sec) : sec);
	return str;
}
function w3(s) {
	if (!s)
		return new Date();
	var y = s.substring(0, 4);
	var m = s.substring(5, 7);
	var d = s.substring(8, 10);
	var h = s.substring(11, 14);
	var min = s.substring(15, 17);
	var sec = s.substring(18, 20);
	if (!isNaN(y) && !isNaN(m) && !isNaN(d) && !isNaN(h) && !isNaN(min)
			&& !isNaN(sec)) {
		return new Date(y, m - 1, d, h, min, sec);
	} else {
		return new Date();
	}
}
function myNumberic(e,len) {
    var obj=e.srcElement || e.target;
    var dot=obj.value.indexOf(".");//alert(e.which);
    len =(typeof(len)=="undefined")?2:len;
    var  key=e.keyCode|| e.which;
    if(key==8 || key==9 || key==46 || (key>=37  && key<=40))//这里为了兼容Firefox的backspace,tab,del,方向键
        return true;
    if (key<=57 && key>=48) { //数字
        if(dot==-1)//没有小数点
            return true;
        else if(obj.value.length<=dot+len)//小数位数
            return true;
        } else if((key==46) && dot==-1){//小数点
            return true;
    }        
    return false;
}